<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class OverTime extends CI_Controller {

 function __construct()
 {
   parent::__construct();
   $this->load->model('muser');
   $this->load->library('form_validation');
   $this->load->library('pagination');
 }
 function index(){	 
	 
 	 $config['base_url'] = base_url().'overTime/index'; 
	 $config['total_rows'] = $this->muser->num_rows('OverTime');
	 
	 $config['per_page'] = 10; // xác định số record ở mỗi trang  
     $config['uri_segment'] = 3; // xác định segment chứa page number  
	 $this->pagination->initialize($config); 
	 $data['result']=$this->muser->getalldata('OverTime',$config['per_page'],$this->uri->segment(3));	
	 $type=array(
				"T"=>"T",
				"N"=>"N"
				);
	$data['type']=$type;					 
	 $this->load->view('_header');
     $this->load->view('overTime/overTime_view',$data); 
     $this->load->view('_footer');
 }

 function insert(){
 		$DT=array(
					"OverTime_ID"=>$this->input->post('OverTime_ID'),
					"OT_Weekday"=>$this->input->post('OT_Weekday'),
					"Time_Saturday"=>$this->input->post('Time_Saturday'),
					"OT_Saturday"=>$this->input->post('OT_Saturday'),
					"OT_Sunday"=>$this->input->post('OT_Sunday'),
					"OT_Holiday"=>$this->input->post('OT_Holiday'),
					"ON_Weekday"=>$this->input->post('ON_Weekday'),
					"ON_Sunday"=>$this->input->post('ON_Sunday'),
					"ON_Holiday"=>$this->input->post('ON_Holiday'),
					"EffectiveDate"=>$this->input->post('EffectiveDate'),
					"Type"=>$this->input->post('Type')				
			);			
		$this->muser->addData('OverTime',$DT);
		$data['error']='Insert successful!';
		redirect('overTime/index');
 }	
 function delete($OverTime_ID){ 	
 		$this->muser->delColumn('OverTime','OverTime_ID',$SHU_ID);
		redirect('overTime/index');
	 }
 function edit1 ()
 {
 	$DT=array(
					"OverTime_ID"=>$this->input->post('OverTime_ID'),
					"OT_Weekday"=>$this->input->post('OT_Weekday'),
					"Time_Saturday"=>$this->input->post('Time_Saturday'),
					"OT_Saturday"=>$this->input->post('OT_Saturday'),
					"OT_Sunday"=>$this->input->post('OT_Sunday'),
					"OT_Holiday"=>$this->input->post('OT_Holiday'),
					"ON_Weekday"=>$this->input->post('ON_Weekday'),
					"ON_Sunday"=>$this->input->post('ON_Sunday'),
					"ON_Holiday"=>$this->input->post('ON_Holiday'),
					"EffectiveDate"=>$this->input->post('EffectiveDate'),
					"Type"=>$this->input->post('Type')				
			);	
	$this->muser->updateData('OverTime','OverTime_ID',$DT['OverTime_ID'],$DT);
	$data['error']='Edit successful!';	 	
	redirect('overTime/index');		
 } 
 function edit($str)
 {	
 	$result=$this->muser->getRdata('OverTime','OverTime_ID',$str);
	$data['result']=$result;
	$type=array(
				"T"=>"T",
				"N"=>"N"
				);
	$data['type']=$type;	
 	$this->load->view('_header');
	$this->load->view('overTime/editOverTime_view',$data);	
	$this->load->view('_footer');
 }
 
 function check_OverTime($str){
 		return $this->muser->checkData('OverTime','OverTime_ID',$str);		
 }
 }